(function () {
    var core = ecui,
        util = core.util,
        dom = ecui.dom;

    ecui.util.extend(
        NS.ui,
        {
            StarRadio: ecui.inherits(
                ecui.ui.Radio,
                {
                    onclick: function () {
                        var children = dom.children(dom.parent(this.getMain())),
                            flag = true;
                        children.forEach(function (item) {
                            var control = item.getControl();
                            if (flag) {
                                if (!dom.hasClass(control.getMain(), 'ui-radio-bright')) {
                                    control.alterStatus('+bright');
                                }
                            } else {
                                control.alterStatus('-bright');
                            }
                            if (control === this) {
                                flag = false;
                            }
                        }.bind(this));
                    }
                }
            ),
            SponsorContentSave: ecui.inherits(
                mao.ui.Submit,
                {
                    onclick: function () {
                        this.request(
                            'data@FORM /erp-management/message/h5/add-sponsor-comment?sponsorValuationForm',
                            function () {
                                var data = ecui.esr.getData('data');
                                if (data instanceof Object) {
                                    ecui.tip('warn', '评论成功');
                                    history.go(-1);
                                }
                            }
                        );
                    }
                }
            )
        }
    );
    ecui.esr.addRoute('sponsor', {
        model: [
            'detail@GET /erp-management/customer/sponsor/${id}'
        ],
        weight: 10,
        main: 'info_valuation-sponsor',
        view: 'valuation.sponsor',
        // queryUrl: '@JSON /erp-management/data-bank/h5/sponsor/${id}/play-list',
        frame: true,
        CACHE: false,
        onbeforerequest: function (context) {
        },
        onafterrender: function (context) {
            // ecui.dispatchEvent(ecui.get('sponsor-perform-list-view'), 'refresh');
        }
    });
}());